:root {
            --bg-color: #000000;
            --sidebar-bg: #080c0e;
            --text-color: #ffffff;
            --subtext-color: #567c89;
            --accent-steel: #2d3a40;
            --nav-hover: #12191c;
            --sidebar-width: 240px;
            --system-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            --collapsed-width: 70px;
            --transition-speed: 0.3s;
        }

        * { box-sizing: border-box; }

        body {
            background-color: var(--bg-color);
            color: var(--text-color);
            font-family: var(--system-font);
            margin: 0;
            display: flex;
            height: 100vh;
            width: 100vw;
            overflow: hidden;
            font-weight: 300;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* --- SIDEBAR --- */
        aside {
            width: var(--sidebar-width);
            background-color: var(--sidebar-bg);
            border-right: 1px solid var(--accent-steel);
            display: flex;
            flex-direction: column;
            height: 100vh;
            z-index: 100;
            flex-shrink: 0;
            transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            /* CRITICAL FIX: Allows trays to slide out without scrollbars */
            overflow: visible; 
        }
        
        .site-header { padding: 50px 10px 30px 10px; text-align: center; }

       /*old .logo-text, 
        a.logo-text, 
        a.logo-text:visited, 
        a.logo-text:hover, 
        a.logo-text:active {

    font-family: Georgia, serif; 
    font-size: 1.4em; 
    letter-spacing: 10px; 
    color: #ffffff !important; 
    text-transform: uppercase;
    text-decoration: none !important; 
    transform: scaleY(2.3);
    transform-origin: center;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 45%, rgba(0,0,0,0.1) 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 45%, rgba(0,0,0,0.1) 80%, transparent 100%);
    -webkit-tap-highlight-color: transparent;
    outline: none;
    cursor: default;
        } */
        .logo-text, 
a.logo-text, 
a.logo-text:visited, 
a.logo-text:hover, 
a.logo-text:active {
    display: inline-block;
    font-family: Georgia, serif; 
    /* Reduced font-size to offset the 'Big' look */
    font-size: 1.1em; 
    letter-spacing: 10px; 
    color: #ffffff !important; 
    text-transform: uppercase;
    text-decoration: none !important;
    
    /* Vertical Stretch */
    transform: scaleY(2.3);
    transform-origin: center;
    line-height: 1; /* Prevents extra vertical space from the stretch */
    
    /* Fade Effect */
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 45%, rgba(0,0,0,0.1) 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 45%, rgba(0,0,0,0.1) 80%, transparent 100%);
    
    /* Neutralize Highlights */
    -webkit-tap-highlight-color: transparent;
    outline: none;
    cursor: pointer; /* Changed to pointer so users know it's a home link */
}
        /* --- NAVIGATION --- */
        /* CRITICAL FIX: Allows trays to slide out without scrollbars */
        nav { padding: 20px 0; overflow: visible; }

        .nav-section { border-bottom: 1px solid rgba(45, 58, 64, 0.3); }
        .nav-header {
            width: 100%; padding: 28px 26px;
            background: none; border: none;
            color: var(--subtext-color); text-align: left;
            text-transform: uppercase; letter-spacing: 2px; font-size: 0.85em;
            cursor: pointer; display: flex; justify-content: space-between;
            transition: 0.3s;
            font-family: var(--system-font);
            font-weight: 600;
            gap: 15px;
            display: flex;          /* puts the icon and text on the same line */
            align-items: center;
            position: relative;
        }
        .nav-header:hover { color: var(--text-color); background: var(--nav-hover); }
        .sub-nav { display: none; list-style: none; padding: 0; margin: 0; background: rgba(0, 0, 0, 0.2); }
        .nav-section.active .sub-nav { display: block; }
        .sub-nav li a { display: block; padding: 18px 35px; color: var(--subtext-color); text-decoration: none; letter-spacing: 2px; font-size: 0.90em; }
        .sub-nav li a:hover { color: var(--text-color); }

        /* Toggle Button Styling */
        #sidebar-toggle {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: none;
            border: 1px solid var(--accent-steel);
            color: var(--subtext-color);
            cursor: pointer;
            padding: 8px;
            border-radius: 4px;
            z-index: 1002;
        }

        /* ========= COLLAPSED STATE LOGIC ========= */
        aside.collapsed { width: var(--collapsed-width); }

        /* 1. V-Logo Centering Fix */
        aside.collapsed .site-header {
            padding-left: 0;
            padding-right: 0;
        }
        aside.collapsed .logo-text {
            letter-spacing: 0;
            width: 100%;
        }
        aside.collapsed .logo-rest { display: none; }
        
        /* 2. Icon Centering */
        aside.collapsed .nav-header {
            justify-content: center;
            padding: 28px 0;
        }

        /* 3. The Sliding Tray */
        aside.collapsed .nav-header span { 
            position: absolute;
            left: 100%;
            top: 0;
            height: 100%;
            width: auto;
            min-width: 180px;
            pointer-events: auto; /* Ensures the text itself captures clicks */
            
            /* TRAY COLOR FIX: Changed to nav-hover color */
            background-color: var(--nav-hover); 
            color: var(--text-color);
            border: 1px solid var(--accent-steel);
            border-left: none; 
            
            display: flex;
            align-items: center;
            padding-left: 25px;
            padding-right: 20px;
            
            opacity: 0;
            visibility: hidden;
            transform: translateX(-20px);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            
            z-index: 1000;
            white-space: nowrap;
            box-shadow: 10px 5px 20px rgba(0, 0, 0, 0.6);
            pointer-events: none;
        }
        /* Ensure the new anchor tags look and behave like the old buttons */
a.nav-header {
    text-decoration: none; /* Removes underline */
    display: flex;         /* Maintains icon/text alignment */
       /* Keeps your white/grey colors */
    width: 100%;
    outline: none;
}
        /* Reveal Tray on Hover */
        aside.collapsed .nav-header:hover span {
            opacity: 1;
            visibility: visible;
            transform: translateX(0);
            pointer-events: auto;
        }

        /* Icon Glow on Hover */
        aside.collapsed .nav-header:hover i {
            color: var(--text-color);
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
        }
/* Align Phosphor icons with existing sidebar aesthetic */
.ph {
    font-size: 20px;       /* Keeps icons consistent */
    min-width: 20px;       /* Prevents layout shift */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure icons are centered when sidebar is collapsed */
aside.collapsed .nav-header {
    justify-content: center;
}

aside.collapsed .nav-header i {
    margin-right: 0;
}

        /* --- MAIN AREA & DIMMER --- */
        main {
            flex-grow: 1;
            height: 100vh;
            overflow-y: scroll;
            position: relative;
            background-image: url('../images/banner.png'); 
            background-attachment: fixed;
            background-repeat: no-repeat;
            background-size: cover;
            background-position: center top;
        }

        #dimmer, main::after {
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            pointer-events: none;
            margin-left: var(--sidebar-width);
            transition: margin-left var(--transition-speed) ease;
        }

        #dimmer { background: black; opacity: 0; z-index: 1; pointer-events: none; }
        main::after { content: ""; backdrop-filter: sepia(0.3) brightness(0.8); z-index: 0; }

        aside.collapsed ~ #dimmer,
        aside.collapsed ~ main::after { margin-left: var(--collapsed-width); }

        .content-ledger {
            position: relative; z-index: 10;
            max-width: 850px; width: 90%;
            margin: 0 auto; padding: 10vh 0 60px 0;
        }

        /* --- TYPOGRAPHY & BOXES --- */
        h2 { 
            font-family: Georgia, serif; font-size: 1.8em; letter-spacing: 8px; text-transform: uppercase; color: var(--subtext-color); padding-bottom: 10px; margin-bottom: 2px; font-weight: normal;
            border-bottom: 1px solid; border-image-source: linear-gradient(to right, transparent, var(--accent-steel), transparent); border-image-slice: 1;
            max-width: 580px; margin-left: auto; margin-right: auto;
        }

        h3 { font-family: Georgia, serif; color: var(--subtext-color); text-transform: uppercase; letter-spacing: 4px; font-size: 1.1em; margin-top: 2px; font-weight: normal; max-width: 600px; }

        p { line-height: 1.8; font-size: 1.05em; opacity: 0.8; margin-bottom: 1px; letter-spacing: 0.02em; }
        
        section { display: flex; flex-direction: column; max-width: 580px; margin-left: auto; margin-right: auto; align-items: flex-start; }
        section p { margin-bottom: 1px; }

        .quote-box { border-radius: 12px; padding: 20px 20px 60px 20px; border: 1px solid var(--accent-steel); background: rgba(8, 12, 14, 0.8); position: relative; max-width: 560px; min-width: 480px; margin: 10px auto; display: flex; flex-direction: column; align-items: center; }
        .quote-box p { font-style: italic; font-weight: 200; font-size: 0.89em; }
        .quote-box p span { display: inline-block; transform-origin: top; }
        .quote-box strong { color: var(--subtext-color); letter-spacing: 1px;   }
        .drop-1 { transform: translateY(0px) scaleY(1.1); opacity: 1.0; }
        .drop-2 { transform: translateY(5px) scaleY(1.15); opacity: 0.95; }
        .drop-3 { transform: translateY(12px) scaleY(1.2); opacity: 0.85; }
        .drop-4 { transform: translateY(20px) scaleY(1.25); opacity: 0.7; }
        .drop-5 { transform: translateY(20px) scaleY(1.25); opacity: 0.5; filter: blur(.5px); }
        .drop-6 { transform: translateY(20px) scaleY(1.25); opacity: 0.3; filter: blur(.8px); }
        .quote-box::after { content: "— American Psycho"; position: absolute; bottom: 23px; right: 40px; font-size: 0.7em; letter-spacing: 2px; color: var(--subtext-color); text-transform: uppercase; font-style: normal; font-weight: 600; }

        .feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 35px; margin: 40px 0; }
        .feature-item { border-left: 1px solid var(--accent-steel); padding-left: 20px; }
        .feature-item strong { display: block; text-transform: uppercase; font-size: 0.75em; letter-spacing: 2px; color: var(--subtext-color); margin-bottom: 0px; font-weight: 600; }

        .trade-callout { padding: 30px 40px; margin: 40px 0; width: 100%; background: linear-gradient(90deg, rgba(45, 58, 64, 0.3) 0%, rgba(45, 58, 64, 0.05) 60%, transparent 100%); border-left: 4px solid var(--subtext-color); line-height: 1.6; font-size: 0.95em; color: rgba(255, 255, 255, 0.9); }
        .trade-callout strong { color: var(--subtext-color); letter-spacing: 1px; text-transform: uppercase; font-size: 0.85em; }
        
        .mainline strong { color: var(--subtext-color);    }

        .knack-box { border: 1px solid var(--accent-steel); padding: 30px; background: rgba(8, 12, 14, 0.6); position: relative; border-radius: 12px; max-width: 560px; margin: 60px auto; }
        .knack-box::before { content: "THE THIRD ATTRIBUTE"; position: absolute; top: -12px; left: 30px; background: var(--bg-color); padding: 0 15px; font-size: 0.65em; letter-spacing: 3px; color: var(--subtext-color); text-transform: uppercase; font-weight: 600; }

        hr.thin-line { border: 0; height: 1px; background: linear-gradient(to right, var(--accent-steel), transparent); max-width: 560px; margin: 60px auto; }
        
        @media (max-width: 768px) {
            aside { display: none; }
            #dimmer, main::after { margin-left: 0; }
            .feature-grid { grid-template-columns: 1fr; }
        }
        /* --- TOGGLE BUTTON ARROW LOGIC --- */
        
        /* 1. Default State (Sidebar is Open): Show Left Arrow, Hide Right Arrow */
        #sidebar-toggle .ph-caret-circle-left { display: block; }
        #sidebar-toggle .ph-caret-circle-right { display: none; }
        
        /* 2. Collapsed State (Sidebar is Closed): Hide Left Arrow, Show Right Arrow */
        aside.collapsed #sidebar-toggle .ph-caret-circle-left { display: none; }
        aside.collapsed #sidebar-toggle .ph-caret-circle-right { display: block; }
        
        /* Optional: Make the arrow nudge slightly on hover for a tactile feel */
        #sidebar-toggle:hover .ph-caret-circle-left { transform: translateX(-2px); }
        #sidebar-toggle:hover .ph-caret-circle-right { transform: translateX(2px); }
        
        /* --- RANDOM GENERATOR ADAPTATIONS --- */

        .generator-container {
            text-align: center;
            max-width: 600px;
            width: 100%;
            margin: 40px auto;
            border-top: 0px solid var(--accent-steel);
            border-bottom: 0px solid var(--accent-steel);
            padding: 40px 0;
        }
        
        .gen-button {
            background-color: var(--sidebar-bg);
            color: var(--subtext-color);
            border: 1px solid var(--accent-steel);
            padding: 14px 28px;
            font-size: 15px;
            cursor: pointer;
            border-radius: 2px; 
            transition: all 0.4s ease;
            font-family: 'Courier New', Courier, monospace;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 2px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.5);
        }
        
        .gen-button:hover {
            background-color: var(--nav-hover);
            color: var(--text-color);
            border-color: var(--subtext-color);
            box-shadow: 0 0 15px rgba(86, 124, 137, 0.2);
            transform: translateY(-1px);
        }
        .nav-header a {
            color: inherit;
            text-decoration: none;
            display: inline-block;
            width: 100%;
        }
        .gen-output {
            margin-top: 20px;
            text-align: left;
            line-height: 1.6;
            padding: 30px;
            min-height: 150px;
            display: none;
            animation: flickerIn 0.8s ease-out;
            background: linear-gradient(to bottom, rgba(45, 58, 64, 0.1), transparent);
            border-left: 2px solid var(--subtext-color);
            border-right: 2px solid var(--subtext-color);
        }
        
        @keyframes flickerIn {
            0% { opacity: 0; transform: translateY(5px); }
            30% { opacity: 0.4; }
            40% { opacity: 0.2; }
            100% { opacity: 1; transform: translateY(0); }
        }
        
        .result-block {
            margin-bottom: 2px;
            padding-bottom: 15px;
            border-bottom: 1px dashed var(--accent-steel);
        }
        
        .result-blockbot {
            margin-bottom: 2px;
            padding-bottom: 15px;
            border-bottom: 0px dashed var(--accent-steel);
        }
        
        .result-block:last-child {
            border-bottom: none;
        }
        
        .gen-label {
            color: var(--subtext-color);
            font-family: 'Courier New', Courier, monospace;
            font-weight: bold;
            text-transform: uppercase;
            font-size: 0.85em;
            letter-spacing: 3px;
            display: block;
            margin-bottom: 2px;
            opacity: 0.8;
        }
        .gen-content {
            font-size: .9em;
            letter-spacing: 0.02em;
        }
            
        .gen-content.identity-name {
            font-family: Georgia, serif;
            font-size: 1.3em;
            color: #ffffff; 

            padding-bottom: 1px;
        }
        
        .gen-content.desc {
            display: block;
            margin-top: 4px;
            font-style: italic; 
            color: var(--subtext-color);
            font-size: 0.95em;
        }
        
        /* Stats Table Container */
.traits-horizontal-table {
    display: flex;
    gap: 0;
    border: 1px solid var(--accent-steel);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
    background: rgba(255,255,255,0.03);
}

/* Individual Stat Box */
.trait-node {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 5px;
    border-right: 1px solid var(--accent-steel);
}

.trait-node:last-child {
    border-right: none;
}

/* Stat Label (GRI, FIN, etc) */
.t-label {
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    font-weight: bold;
    color: var(--subtext-color);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

/* Stat Number */
.t-val {
    font-size: 1.4em;
    font-weight: bold;
    color: #fff;
}

/* Highlight for EDGE or special stats */
.trait-node.active {
    background: rgba(86, 124, 137, 0.15); /* Uses your subtext color */
}

.no-border {
    border: none !important;
}

.gen-header {
    text-align: center;
    border-bottom: 0px solid var(--accent-steel);
    padding-bottom: 10px;
}

/* Core Body Layout */
.gen-body-core {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
    margin-top: 20px;
    padding-bottom: 2pxpx;
    border-bottom: 0px solid rgba(255,255,255,0.05);
}

/* Optional Footer Section */
.gen-optional-footer {
    margin-top: 2px;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
}

.optional-title {
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--subtext-color);
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid var(--accent-steel);
    padding-bottom: 5px;
}

.optional-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Four columns across */
    gap: 15px;
}

/* Smaller text for optional fields */
.gen-content-small {
    font-size: 0.85em;
    display: block;
    line-height: 1.3;
}

/* Adjust for smaller screens/responsive */
@media (max-width: 800px) {
    .optional-grid {
        grid-template-columns: 1fr 1fr;
    }
}